package com.example.administrator.testc.TestAF;/**
 * Created by Administrator on 2016/4/14 0014.
 */

import android.os.Bundle;
import android.os.Message;
import android.view.View;
import android.widget.Button;

import com.example.administrator.testc.mApp;

import pri.zey.custom.AFMananger.ActivityBase;
import pri.zey.custom.AFMananger.InterfaceHandler;
import pri.zey.custom.tools.TL;

/**
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>类描述
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>属性描述
 * >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>方法描述
 */
public class Activity_2 extends ActivityBase {

    Button bt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bt = new Button(this);
        bt.setText(this.toString());
        setContentView(bt);
        bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Message msg = new Message();
                msg.what = 110;
                msg.obj = this;
                Bundle bundle = new Bundle();
                bundle.putString("key", this.getClass().getName() + " >> 123456789");
                msg.setData(bundle);
//                Handler MsgHandler = ((CustomApplication)getApplicationContext()).getHandler();
//                MsgHandler.sendMessage(msg);
//                mApp.control.sendMsg(Activity_1.class.getName(), MsgHandler, IHandler);
                mApp.control.SMsg(Activity_1.class.getName(), IHandler);
            }
        });
        IHandler = new InterfaceHandler() {
            @Override
            public void onRequest(ActivityBase msg) {
                bt.setText("asdfghjjkl");
            }

            @Override
            public void onResponse(ActivityBase msg) {
                bt.setText(bt.getText() + "\"n" + "!@$%^&^&");
            }
        };
    }

    @Override
    protected void onRestart() {
        super.onRestart();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        TL.e("TAGSS", "destroy " + this.toString());
    }
}
